home *** CD-ROM | disk | FTP | other *** search
/ Network Supervisor's Toolkit / Network Supervisor's Toolkit.iso / tools / nwtp06 / nwpn9401.txt < prev    next >
Text File  |  1996-07-10  |  7KB  |  200 lines

  1. NWTP Note 0501 "About the encryption mechanism"
  2.  
  3. This note discribes the password encryption mechanisms as used by Novell
  4. Netware 3.x/4.x. Passwords are encrypted by workstations
  5. and servers. The password verification process is also based on encryption.
  6.  
  7. This note describes the entire process of password verification and
  8. password change. It has 3 appendices:
  9. 1. A description of the ASM calls involved with encrypted passwords;
  10. 2. Sourcecode of the encryption routines and tables in Turbo Pascal;
  11. 3. Sourcecode of the encryption routines and tables in C.
  12.  
  13.  Initial state
  14.  =============
  15.  
  16.  Our transaction model starts with a description of the initial state
  17.  of the server.
  18.  
  19.  The following tables are stored at the server:
  20.  
  21.   -The EncryptionKeyTable, containing an 8 byte EncryptionKey for
  22.      every workstation connection. This table can be queried by
  23.      workstations using the GetEncryptionKey (INT 21h, AX=F217h, subf. 17h).
  24.      Table entry [c] is renewed whenever connection c used a call using
  25.      encrypted passwords.
  26.  
  27.   -The PasswordTable containing an 16 Byte encrypted password
  28.      (socalled "Shuffled" Password) for every connection.
  29.  
  30.  A short description of the various encryption mechanisms involved:
  31.  
  32.   -Shuffling. ('S' for short)
  33.      The encryption of the password (string of char) into 16 bytes (the
  34.      shuffled password), using a number of static tables and the objectID
  35.      of the object the password is associated with.
  36.  
  37.      In Mathematical terms:
  38.       ShuffledPassWord=S(PasswordString) or Spw=S(pw)
  39.  
  40.   -Encryption ('E' for short)
  41.      The main encryption process, encrypting the shuffled password (S(pw)
  42.      for short) into 8 bytes, using the same static tables as the Shuffling
  43.      functions and a dynamic encryption key requested from the server.
  44.  
  45.      In mathematical terms:
  46.       EncryptedPassWord=E(EncryptionKey,ShuffledPassword) or Epw=E(Ekey,Spw)
  47.  
  48.   -EncryptDifference ('D' for short)
  49.      Encrypts the 'difference' between the Shuffled old password and the
  50.      Shuffled new password, using a static table. The encrypted difference
  51.      is passed to the server. The computed 'difference' consist of
  52.      16 bytes of data and 1 checksum byte.
  53.  
  54.      In mathematical terms:
  55.       PasswordDiff=D(ShuffledOldPW,ShuffledNewPW) or pwDiff=D(SOpw,SNpw)
  56.  
  57.   -DecryptDifference ('Dinv' for short)
  58.      Server decryption process. Decrypts a 'password-difference'
  59.      encrypted block as suplied by a workstation to a shuffled version
  60.      of the new password. The shuffled old password, as stored in the
  61.      servers' EncryptionKeyTable is used in the decryption process.
  62.  
  63.      In mathematical terms:
  64.       ShuffledNewPW=Dinv(ShuffledOldPW,PasswordDiff) or SNpw=Dinv(SOpw,pwDiff)
  65.       Notes:-ShuffledOldPassword is taken by the server from its'
  66.              EncryptionKeyTable, i.e. ShuffledOldPassword=EncryptionKeyTable[c]
  67.              where c is the connection number of the object the password
  68.              is associated with.
  69.             -SNpw=Dinv(SOpw,D(SNpw,Opw)), hence the name "D inverse".
  70.  
  71.   -GenerateNewKey ('GNK' for short)
  72.      The server process creating a new encryption key for a certain
  73.      connection after the previous one has been used by that connection.
  74.  
  75.      In mathematical terms:
  76.       EncryptionKeyTable[c]:=GenerateNewKey(EncryptionTable[c])
  77.  
  78.  
  79.  Password Verification
  80.  =====================
  81.  
  82.    Password verification procedure when the encrypted password calls
  83.    (VerifyEncrBinderyObjectPassword and LoginEncrToFileServer)
  84.    are used:
  85.  
  86.     Workstation                       Server
  87.     ===========                       ======
  88.  
  89.     GetEncryptionKey ----------------> Return EncryptionKeyTable[c]
  90.  
  91.        EncrKey       <---------------------
  92.  
  93.     Epw:=E(EncrKey,S(pw))
  94.  
  95.     Verify/Login(Epw) ---------------> Epw'=E(EncryptionKeyTable[c],
  96.                                               PasswordTable[c])
  97.  
  98.                                        Epw'=Epw ?
  99.      completion code  <--------------------
  100.  
  101.                                        EncryptionKeyTable[c]=
  102.                                               GNK(EncryptionKeyTable[c])
  103.  
  104.     Note: c  = Workstation connection number
  105.           pw = Password (string, max. 128 characters)
  106.           Epw= Encrypted Password (8 bytes)
  107.  
  108.  
  109.    Password verification procedure when the calls using unencrypted
  110.    passwords (VerifyBinderyObjectPassword and LoginToFileserver)
  111.    are used in combination with a 3.x server:
  112.  
  113.     Workstation                       Server
  114.     ===========                       ======
  115.  
  116.  
  117.     Verify/Login(pw) ---------------->
  118.  
  119.                                        S(pw)=PasswordTable[c] ?
  120.      completion code  <--------------------
  121.  
  122.                                        EncryptionKeyTable[c]=
  123.                                               GNK(EncryptionKeyTable[c])
  124.  
  125.     Note: c  = Workstation connection number
  126.           pw = Password (string, max. 128 characters)
  127.  
  128.  
  129.  
  130.  Changing Passwords
  131.  ==================
  132.  
  133.    The process of changeing a password using encrypted passwords:
  134.  
  135.     Workstation                       Server
  136.     ===========                       ======
  137.  
  138.     GetEncryptionKey ----------------> Return EncryptionKeyTable[c]
  139.  
  140.        EncrKey       <---------------------
  141.  
  142.     SOpw=S(oldPW)
  143.     SNpw=S(newPW)
  144.  
  145.     EOpw=E(encrKey,SOpw)
  146.  
  147.     PWdif=D(SNpw,SOpw)
  148.  
  149.     ChangeEncrBinderyObjPW
  150.      (EOpw,PWdiff)
  151.                        --------------> Epw'=E(EncryptionKeyTable[c],
  152.                                               PasswordTable[c])
  153.  
  154.                                        Epw'=Epw ?
  155.      completion code  <--------------------
  156.  
  157.                                        SNpw'=Dinv(PasswordTable[c],
  158.                                                   PWdiff)
  159.                                        PasswordTable[c]=SNpw'
  160.  
  161.                                        EncryptionKeyTable[c]=
  162.                                               GNK(EncryptionKeyTable[c])
  163.  
  164.  
  165.      Note: c     = Workstation connection number
  166.            OldPW = Old password (string, max. 128 characters)
  167.            NewPW = New password (string, max. 128 characters)
  168.            SNpw  = Shuffled new password  (12 bytes)
  169.            SOpw  = Shuffled old password  (12 bytes)
  170.            EOpw  = Encrypted old Password (8 bytes)
  171.  
  172.  
  173.    THe process of chageing a password when using unencrypted passwords:
  174.  
  175.     Workstation                       Server
  176.     ===========                       ======
  177.  
  178.  
  179.     ChangeBinderyObjPW
  180.      (OldPW,NewPW)
  181.                        -------------->
  182.                                        S(OldPW)=PasswordTable[c] ?
  183.      completion code  <--------------------
  184.  
  185.                                        PasswordTable[c]=S(NewPW)
  186.  
  187.                                        EncryptionKeyTable[c]=
  188.                                               GNK(EncryptionKeyTable[c])
  189.  
  190.  
  191.      Note: c      = Workstation connection number
  192.            OldPW  = Old password (string, max. 128 characters)
  193.            NewPW  = New password (string, max. 128 characters)
  194.  
  195.  
  196. Sources: NVPW.C by Itsme [Itsme@Hacktic.nl]
  197.          LOGON.PAS by Barry Nance/Terje Mathesen, Byte, March 1993.
  198.  
  199.  
  200.